import request from '@/utils/http/axios';

// 查询公告列表
export async function listNotice(query) {
  return request({
    url: '/image/list',
    method: 'get',
    params: query,
  });
}

// 查询公告详细
export async function getNotice(id) {
  return request({
    url: '/image/selectJyImageById',
    method: 'get',
    params: { id },
  });
}

// 查询公告sort
export async function getNoticeSortMax() {
  return request({
    url: '/image/selectNextSort',
    method: 'get',
  });
}
export async function getNoticeSort() {
  return request({
    url: '/image/selectNextSort',
    method: 'get',
  });
}

// 新增公告
export async function addNotice(data) {
  return request({
    url: '/image/add',
    method: 'post',
    data,
  });
}

// 修改公告
export async function updateNotice(data) {
  return request({
    url: '/image/edit',
    method: 'put',
    data,
  });
}
export async function updateNoticeStatus(id, status) {
  return request({
    url: `/image/edit/${id}/${status}`,
    method: 'put',
  });
}

// 删除公告
export async function delNotice(noticeId) {
  return request({
    url: `/image/delete/${noticeId}`,
    method: 'delete',
  });
}
